package com.qing.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;

import com.qing.service.JobService;
import com.qing.pojo.Job;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author qinghua
 * @since 2022-06-06
 */
@RestController
@RequestMapping("/job")
public class JobController {
    @Autowired
    private JobService jobService;

    @PostMapping("/insert")
    public Boolean save(@RequestBody Job job) {
        return jobService.saveOrUpdate(job);
    }

    @GetMapping("/deleteById/{id}")
    public Boolean delete(@PathVariable Integer id) {
        return jobService.removeById(id);
    }

    @GetMapping("/queryAll")
    public List<Job> queryAll() {
        return jobService.list();
    }

    @GetMapping("/queryById/{id}")
    public Job findOne(@PathVariable Integer id) {
        return jobService.getById(id);
    }

}

